import React from 'react';
import BasicLayout from '@/layouts/BasicLayout';
import UserLayout from '@/layouts/UserLayout';
import SubRouteLayout from './layouts/SubRouteLayout';

// import NotFound from '@/components/NotFound'; // 页面没找到

import Dashboard from '@/pages/Dashboard';
import Login from '@/pages/user/Login';
import Register from '@/pages/user/Register';
import ResetPassword from '@/pages/user/ResetPassword';

import Order from '@/pages/Order';
import Task from '@/pages/Task';
import Evaluate from '@/pages/Evaluate';
import Transaction from '@/pages/Transaction';
import Transfer from '@/pages/Transfer';
import DayRecord from '@/pages/reportForm/DayRecord';
import Company from '@/pages/Company';
import Member from '@/pages/Member';
import Log from '@/pages/sys/Log';
import PV from '@/pages/sys/PV';
import Rule from '@/pages/sys/Rule';

const routerConfig = [
  {
    path: '/user',
    component: UserLayout,
    children: [
      {
        path: '/login',
        component: Login,
      },
      {
        path: '/register',
        component: Register,
      },
      {
        path: '/resetpassword',
        component: ResetPassword,
      },
      {
        path: '/',
        redirect: '/user/login',
      },
    ],
  },
  {
    path: '/',
    component: BasicLayout,
    children: [
      {
        path: '/dashboard',
        component: Dashboard,
      },

      // 公司管理
      {
        path: '/company',
        component: Company,
      },

      // 成员管理
      {
        path: '/member',
        component: Member,
      },

      // 订单管理
      {
        path: '/order',
        component: Order,
      },

      // 任务管理
      {
        path: '/task',
        component: Task,
      },

      // 交易管理
      {
        path: '/integral',
        component: SubRouteLayout,
      },

      // 积分管理
      {
        path: '/point',
        component: SubRouteLayout,
        children: [
          {
            path: '/transaction',
            component: Transaction,
            exact: true,
          },
          {
            path: '/transfer',
            component: Transfer,
            exact: true,
          },
        ],
      },

      // 评价管理
      {
        path: '/evaluate',
        component: Evaluate,
      },

      // 报表管理
      {
        path: '/reportForm/dayRecord',
        component: DayRecord,
      },

      // 系统管理
      {
        path: '/sys/rule',
        component: Rule,
      },
      {
        path: '/sys/pv',
        component: PV,
      },
      {
        path: '/sys/log',
        component: Log,
      },

      // 必须放在最后
      {
        // component: NotFound,
        redirect: '/dashboard',
      },
    ],
  },
];
export default routerConfig;
